import requests from "./requests";
// 登录
export const login = (email, password) =>
  requests({
    method: "POST",
    url: "/user/login",
    data: { email, password },
  });
  //忘记密码
  export const forgetPwd = (email,password) =>
  requests({
    method: "POST",
    url: "/user/forgetPassword",
    data: { email,password },
  });


  //校验用户邮箱是否注册  
export const checkUserEmail = (email) =>
  requests({
    method: "GET",
    url: "/user/searchUserByEmail",
    data: { email },
  });
  //发送验证码
export const sendCode = (email) =>
  requests({
    method: "GET",
    url: "/user/sendEmailCode",
    data: { email },
  });
// 注册
export const register = (email, password) =>
  requests({
    method: "POST",
    url: "/user/register",
    data: { email, password },
  });
// 校验验证码
export const checkEmailCode = (email, code) =>
  requests({
    method: "GET",
    url: "/user/checkEmailCode",
    data: { email, code },
  });
//获取用户信息
export const getUserInfo = () => {
  return requests({
    method: "GET",
    url: "/api/getUserInfo",
  });
};
// 重新生成token
export const refreshToken = () => {
  return requests({
    method: "POST",
    url: "/user/refreshToken",
  });
}
export const getOtherUserInfo=(id)=>{
  return requests({
    method: "GET",
    url: `/api/getOtherUserInfo?id=${id}`,
  });
}

